<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@ taglib tagdir="/WEB-INF/tags/" prefix="jhtag"%>
<!DOCTYPE html >
<html>
<head>
<title>Job Hunter - entreprise</title>
</head>
<body>


	<div id="breadcrumb">
		<a href="/main" >accueil</a> >
		<a href="/companiesList" >entreprises</a>
		 > entreprise
	</div>
	<c:if test="${typeError == 1 }">
		<div>impossible de supprimer une compagnie qui est liée à des
			processus ou des contacts</div>
	</c:if>
	<article class="" id="companyDescription">
		<h1>${company.name }</h1>		
		<div>${company.address }</div>
		<div>${company.phone }</div>
		<div>${company.email }</div>
		<a href="${company.website}" target="_blank">${company.website }</a>
	</article><article id="companyContactList">
		<h1>contacts</h1>
<a href="addContact?compId=${company.id}"><%@ include file="/img/addB.svg"%></a>
		<table class="cell-border dataTable display compact" id="companyContactsList">
			<thead>
				<tr>
					<th>Nom</th>
					<th>Fonction</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${company.contacts}" var="contact">
					<tr>
						<td>${contact.firstName } ${contact.lastName }</td>
						<td>${contact.function }</td>
						<td> <a href="contact?id=${contact.id}"><%@ include file="/img/seeB.svg"%></a>
						<a href="updContact?id=${contact.id}&compId=${company.id}"><%@ include file="/img/updB.svg"%></a>
							<a href="delContact?id=${contact.id}&compId=${company.id}"><%@ include file="/img/delB.svg"%></a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		
	</article><article>
		<h1>Processus enclenché</h1><a href="addProcess?compId=${company.id}"><%@ include file="/img/addB.svg"%></a>
		<table id="companyProcessesList" class="dataTable display compact">
			<thead>
				<tr>
					<th>Nom</th>
					<th>Description</th>
					<th> </th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${company.processes}" var="process">

					<tr>
						<td>${process.name }</td>
						<td><jhtag:substring value="${process.description}" size="60"/></td>
						<td> <a href="process?id=${process.id }"><%@ include file="/img/seeB.svg"%></a> <a
							href="updProcess?id=${process.id }&compId=${company.id}"><%@ include file="/img/updB.svg"%></a>
							<a href="delProcess?id=${process.id }&compId=${company.id}"><%@ include file="/img/delB.svg"%></a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		
	</article><c:if test="${lastProcess!=null }"><article class="article12">
			actions du processus <h1>${lastProcess.name}</h1>			
			
			<a href="addAction?compId=${company.id}&procId=${lastProcess.id}"><%@ include file="/img/addB.svg"%></a>
			<table id="companyLastProcessActionsList" class="dataTable display compact">
				<thead>
					<tr>
						<th>Numéro</th>
						<th>Nom</th>
						<th>Date de l'action</th>
						<th>Description</th>
						<th> </th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${lastProcess.actions}" var="action" varStatus="loop">
						<tr>
						<td>${loop.count }</td>
							<td>${action.name }</td>
							<td>${action.actionDateString }</td>							
							<td><jhtag:substring value="${action.description}" size="60"/></td>
							<td> <a href="action?id=${action.id }"><%@ include file="/img/seeB.svg"%></a>
							 	<a href="updAction?id=${action.id }&compId=${company.id}&procId=${lastProcess.id}"><%@ include file="/img/updB.svg"%></a>
								<a href="delAction?id=${action.id }&compId=${company.id}&procId=${lastProcess.id}"><%@ include file="/img/delB.svg"%></a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</article>
	</c:if>
</body>
</html>